home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 2207 / 2207.xpi / chrome / cooliris.jar / content / cooliris / coolirisFramePanel.js < prev    next >
Text File  |  2010-01-28  |  8KB  |  203 lines

  1. var CoolirisFramePanel={sendLink:"",isSendToOpen:false,sendToBoxLink:"http://www.coolpreviews.com/client/scripts/sendto.php?version=2.7",helperLink:"chrome://cooliris/content/helperFrame.xul",fromPreview:true,subject:"",notes:"",link:"",isHelperFrameOpen:false,helperType:"lock",showHelperFrame:function(){
  2. this.helperType="lock";
  3. var _1=cpvw_prefHandler.getPref(cpvw_Prefs.prefShowHelperFrame);
  4. if(!_1){
  5. return;
  6. }
  7. this.isHelperFrameOpen=true;
  8. this.helperBox=document.createElement("vbox");
  9. this.helperBox.setAttribute("id","cooliris_helperBox");
  10. this.helperFrame=document.createElement("browser");
  11. this.helperFrame.setAttribute("src",CoolirisFramePanel.helperLink);
  12. this.helperFrame.setAttribute("disablehistory",true);
  13. this.helperFrame.setAttribute("id","cooliris_helperFrame");
  14. this.helperFrame.setAttribute("style","width:100%;height:100%;background-color:black;");
  15. this.helperBox.appendChild(this.helperFrame);
  16. this.helperBox.addEventListener("mouseover",function(_2){
  17. clearTimeout(cpvw_docHandler.hideTimer);
  18. },true);
  19. this.helperFrame.addEventListener("coolpreviewsHelperDontShowEvent",function(_3){
  20. CoolirisFramePanel.closeHelperFrame(false);
  21. },false,true);
  22. this.helperFrame.addEventListener("coolpreviewsHelperCloseEvent",function(_4){
  23. CoolirisFramePanel.closeHelperFrame(true);
  24. },false,true);
  25. this.helperFrame.addEventListener("DOMContentLoaded",function(_5){
  26. CoolirisFramePanel.helperFrame.contentDocument.getElementById("cooliris-helper-content").setAttribute("type",CoolirisFramePanel.helperType);
  27. },false,true);
  28. document.getElementById("main-window").appendChild(this.helperBox);
  29. var _6=cpvw_previewHandler.dimPreview;
  30. var _7=_6.left+_6.width-386;
  31. var _8=_6.top+31;
  32. cpvw_jsUtils.setPosition(this.helperBox,_7,_8,385,219);
  33. this.helperBox.setAttribute("class","cooliris-helperframe");
  34. },closeHelperFrame:function(_9){
  35. this.isHelperFrameOpen=false;
  36. if(!_9){
  37. if(this.helperType=="lock"){
  38. cpvw_prefHandler.setPref(cpvw_Prefs.prefShowHelperFrame,false);
  39. }
  40. }
  41. if(cpvw_get("cooliris_helperBox")!=null){
  42. document.getElementById("main-window").removeChild(cpvw_get("cooliris_helperBox"));
  43. }
  44. },sendDirectly:function(_a){
  45. CoolirisFramePanel.fromPreview=false;
  46. var _b=new cpvw_nsNodeType();
  47. _b.getNodeType();
  48. CoolirisFramePanel.link="";
  49. CoolirisFramePanel.notes="";
  50. CoolirisFramePanel.subject="";
  51. if(_b.onImage){
  52. CoolirisFramePanel.link=_b.imageURL;
  53. }else{
  54. if(_b.onLink){
  55. CoolirisFramePanel.link=_b.linkURL;
  56. }else{
  57. if(_b.isTextSelected){
  58. var _c=document.commandDispatcher.focusedWindow;
  59. var _d=_c.getSelection();
  60. CoolirisFramePanel.notes=_d;
  61. }else{
  62. CoolirisFramePanel.link=document.popupNode.ownerDocument.location.href;
  63. CoolirisFramePanel.subject=document.popupNode.ownerDocument.title;
  64. }
  65. }
  66. }
  67. CoolirisFramePanel.showSendTo(_a,false);
  68. },showSendTo:function(_e,_f){
  69. this.fromPreview=_f;
  70. if(this.isSendToOpen){
  71. this.closeSendToOptions();
  72. return;
  73. }
  74. cpvw_objStats.sendButtonClickEvents("SendTo");
  75. this.isSendToOpen=true;
  76. this.sendToBox=document.createElement("vbox");
  77. this.sendToBox.setAttribute("id","cooliris_sendToBox");
  78. this.sendToFrame=document.createElement("browser");
  79. this.sendToFrame.setAttribute("src",CoolirisFramePanel.sendToBoxLink);
  80. this.sendToFrame.setAttribute("disablehistory",true);
  81. this.sendToFrame.setAttribute("id","cooliris_sendToFrame");
  82. this.sendToFrame.setAttribute("style","width:100%;height:100%;background-color:black;");
  83. this.sendToFrame.addEventListener("load",function(_10){
  84. CoolirisFramePanel.onIframeLoad(_10);
  85. },true);
  86. this.sendToBox.appendChild(this.sendToFrame);
  87. this.sendToFrame.addEventListener("coolpreviewsClosePopupEvent",function(evt){
  88. CoolirisFramePanel.closeSendToOptions();
  89. },false,true);
  90. cpvw_previewHandler.stickPreview(true);
  91. document.getElementById("main-window").appendChild(this.sendToBox);
  92. this.sendToBox.hidden=false;
  93. cpvw_jsUtils.setPosition(this.sendToBox,1,1,1,1);
  94. this.sendToBox.setAttribute("class","cooliris-innerframe");
  95. },onIframeLoad:function(evt){
  96. var _13=document.getElementById("cooliris_sendToFrame").contentDocument;
  97. var _14,_15;
  98. if(_13.URL.indexOf("login.php")!=-1){
  99. _13.getElementById("cooliris_Register").removeEventListener("click",CoolirisFramePanel.saveUserInfo,false);
  100. _13.getElementById("cooliris_Login").removeEventListener("click",CoolirisFramePanel.saveUserInfo,false);
  101. _13.getElementById("cooliris_Register").addEventListener("click",CoolirisFramePanel.saveUserInfo,false);
  102. _13.getElementById("cooliris_Login").addEventListener("click",CoolirisFramePanel.saveUserInfo,false);
  103. var _16=cpvw_Prefs.getUserInfo();
  104. _13.getElementById("cooliris_UserEmail").value=_16[0];
  105. _14=parseInt(_13.getElementById("width").value);
  106. _15=parseInt(_13.getElementById("height").value);
  107. }else{
  108. if(_13.URL.indexOf("sendto.php")!=-1){
  109. var _17=cpvw_Prefs.getSendToEmail();
  110. if(_13.getElementById("cooliris_sendToLink")==null){
  111. return;
  112. }
  113. if(CoolirisFramePanel.fromPreview){
  114. var _18=cpvw_previewHandler.getPreviewFrame();
  115. var _19=_18.contentDocument.URL;
  116. if(_18.contentDocument.URL=="chrome://cooliris/content/coolirisPreviewImages.htm"){
  117. var doc=_18.contentDocument;
  118. if(doc.getElementById("imgPreview").style.visibility=="visible"){
  119. _19=doc.getElementById("imgPreview").getAttribute("src");
  120. }else{
  121. _19=doc.getElementById("tmpImgPreview").getAttribute("src");
  122. }
  123. }
  124. CoolirisFramePanel.link=_19;
  125. CoolirisFramePanel.subject=_18.contentDocument.title;
  126. CoolirisFramePanel.notes="";
  127. }
  128. _13.getElementById("cooliris_sendToLink").value=CoolirisFramePanel.link;
  129. _13.getElementById("cooliris_sendToEmail").value=_17;
  130. _13.getElementById("cooliris_sendToSubject").value=CoolirisFramePanel.subject;
  131. _13.getElementById("cooliris_sendToNotes").value=CoolirisFramePanel.notes;
  132. _13.getElementById("cooliris_sendToSend").removeEventListener("click",CoolirisFramePanel.saveToEmailAddress,false);
  133. _13.getElementById("cooliris_sendToSend").addEventListener("click",CoolirisFramePanel.saveToEmailAddress,false);
  134. _14=parseInt(_13.getElementById("width").value);
  135. _15=parseInt(_13.getElementById("height").value);
  136. }
  137. }
  138. var _1b=document.getElementById("cooliris_sendToBox");
  139. if(_1b.style.height!=_15){
  140. var _1c=(screen.width/2)-(_14/2);
  141. var top=(screen.height/2)-(_15/2);
  142. if(CoolirisFramePanel.fromPreview){
  143. var _1e=cpvw_previewHandler.dimPreview;
  144. _1c=_1e.left+90;
  145. top=_1e.top+31;
  146. }
  147. cpvw_jsUtils.setPosition(cpvw_get("closeCoolirisFramePanel"),_1c+_14-18,top+1,18,18,true);
  148. cpvw_jsUtils.setPosition(_1b,_1c,top,_14,1);
  149. var _1f=new cooliris_wc_clsWebControl(_1b,new cooliris_wc_Point(_1c,top),new cooliris_wc_Point(_1c,top),"expand");
  150. _1f.setDim(new cooliris_wc_Dim(_14,20),new cooliris_wc_Dim(_14,_15));
  151. _1f.maxTimes=10;
  152. setTimeout(function(){
  153. _1f.expand();
  154. },0);
  155. }
  156. },saveToEmailAddress:function(){
  157. var _20=document.getElementById("cooliris_sendToFrame").contentDocument;
  158. var _21=_20.getElementById("cooliris_sendToEmail").value;
  159. cpvw_Prefs.setSendToEmail(_21);
  160. var _22=1;
  161. if(_21.indexOf(",")!=-1){
  162. _22=_21.split(",").length;
  163. }else{
  164. if(_21.indexOf(";")!=-1){
  165. _22=_21.split(";").length;
  166. }
  167. }
  168. cpvw_objStats.sendMessageEvents(_22);
  169. setTimeout(function(){
  170. CoolirisFramePanel.checkEmailSent();
  171. },500);
  172. },checkEmailSent:function(){
  173. var _23=document.getElementById("cooliris_sendToFrame").contentDocument;
  174. if(_23.getElementById("cooliris_sendToStatus").value=="-1"){
  175. setTimeout(function(){
  176. CoolirisFramePanel.checkEmailSent();
  177. },500);
  178. }
  179. if(_23.getElementById("cooliris_sendToStatus").value=="1"){
  180. setTimeout(function(){
  181. CoolirisFramePanel.closeSendToOptions();
  182. },3000);
  183. }
  184. },closeSendToOptions:function(){
  185. if(this.sendToBox!=null){
  186. document.getElementById("main-window").removeChild(this.sendToBox);
  187. }
  188. delete this.sendToBox;
  189. this.sendToBox=null;
  190. this.isSendToOpen=false;
  191. cpvw_previewHandler.stickPreview(false);
  192. },saveUserInfo:function(){
  193. var _24=document.getElementById("cooliris_sendToFrame").contentDocument;
  194. var _25=_24.getElementById("cooliris_UserEmail").value;
  195. var _26=_24.getElementById("cooliris_UserPwd").value;
  196. if(cpvw_jsUtils.trimWhitespace(_25)==""||cpvw_jsUtils.trimWhitespace(_26)==""){
  197. alert("Username/Password empty");
  198. }else{
  199. cpvw_Prefs.setUserEmail(_25,_26);
  200. }
  201. }};
  202.  
  203.